package com.cx.service.admin.basic.impl;

import com.cx.dao.impl.ChainJKTDaoSupport;
import com.cx.service.admin.basic.ChainBasicPrivilegeManager;
import com.cx.service.admin.basic.ChainBasicPrivilegeRoleManager;
import org.cx.entity.Page;
import org.cx.entity.PageData;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("chainBasicPrivilegeRoleService")
public class ChainBasicPrivilegeRoleService implements ChainBasicPrivilegeRoleManager {

    @Resource(name = "chainJKTDaoSupport")
    private ChainJKTDaoSupport chainJKTDao;


    @Override
    public List<PageData> findPrivilegeRoleDetailPage(Page pg) {
        List<PageData> list = (List<PageData>) chainJKTDao.findForList("PrivilegeRoleMapper.findPrivilegeRoleDetailPage", pg);
        return list;
    }

    @Override
    public List<PageData> findPrivilegeRoleByPageDate(PageData pd) {
        List<PageData> list = (List<PageData>) chainJKTDao.findForList("PrivilegeRoleMapper.findPrivilegeRoleByPd", pd);
        return list;
    }

    @Override
    public PageData selectPrivilegeRoleByID(PageData pd) {
        pd = (PageData) chainJKTDao.findForObject("PrivilegeRoleMapper.selectPrivilegeRoleByID", pd);
        return pd;
    }

    @Override
    public Integer insertPrivilegeRole(PageData pd) {
        Integer result  =(Integer) chainJKTDao.save("PrivilegeRoleMapper.insertPrivilegeRole",pd);
        return result;
    }

    @Override
    public Integer updatePrivilegeRole(PageData pd) {
        Integer result =(Integer) chainJKTDao.update("PrivilegeRoleMapper.updatePrivilegeRole",pd);
        return result;
    }
}
